package com.saer.client.common;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Utils {

	public static boolean isEmpty(String string) {
		return string == null || string.length() < 1;
	}

	public static boolean isEmpty(List<?> list) {
		return list == null || list.size() < 1;
	}

	public static String[] concatArrays(String[] array1, String[] array2) {
		String[] resutl = new String[array1.length + array2.length];

		for (int i = 0; i < array1.length; i++) {
			resutl[i] = array1[i];
		}

		for (int j = array1.length; j < resutl.length; j++) {
			resutl[j] = array2[j - array1.length];
		}

		return resutl;
	}
	
	public static Set<String> split(String value, String separator) {
		Set<String> result = new HashSet<String>();
		
		if (!isEmpty(value) && !isEmpty(separator)) {
			String[] values = value.split(separator);
			for (String s : values) {
				result.add(s);
			}
		}
		
		return result;
	}
	
	public static String capitalizeFully(String string) {
		return Character.toUpperCase(string.charAt(0)) + (string.substring(1)).toLowerCase();
	}


}
